function getXmlHttpRequestObj () {
    var xmlHttpRequestObj;
    if (window.XMLHttpRequest) {
        xmlHttpRequestObj = new XMLHttpRequest();
    } else {
        try {
            xmlHttpRequestObj = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlHttpRequestObj = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                xmlHttpRequestObj = false;
            }
        }
    }

    return (xmlHttpRequestObj);
}

var xmlhttp_menu = getXmlHttpRequestObj();
var xmlhttp_content = getXmlHttpRequestObj();

function setHTTPGetRequest (page_URL, biskuit) {
    var exp = new Date();
    exp.setDate(exp.getDate() + 1);
    var keju = escape(biskuit) + (exp == null ? "" : ("; expires=" + exp.toUTCString()));
    document.cookie = "act_page=" + keju;

    if (! xmlhttp_menu) {
        xmlhttp_menu = getXmlHttpRequestObj();
    }
    if (! xmlhttp_content) {
        xmlhttp_content = getXmlHttpRequestObj();
    }
    if ((! xmlhttp_menu) || (! xmlhttp_content)) {
        document.getElementById('content').appendChild(document.createTextNode('your browser doesn\'t support this operation'));
        return;
    }

    var url_menu = "../../chat?page_URL=" + encodeURI(page_URL + "_menu.jsp");
    xmlhttp_menu.open('GET', url_menu, true);
    xmlhttp_menu.onreadystatechange = getHTTPGetResponse_menu;
    xmlhttp_menu.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp_menu.send(null);

    var url_content = "../../chat?page_URL=" + encodeURI(page_URL + "_content.jsp");
    xmlhttp_content.open('GET', url_content, true);
    xmlhttp_content.onreadystatechange = getHTTPGetResponse_content;
    xmlhttp_content.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp_content.send(null);
}

function getHTTPGetResponse_menu () {
    if ((xmlhttp_menu.readyState == 4) && (xmlhttp_menu.status == 200)) {
        var menu = document.createElement('div');
        menu.id = 'menu';
        menu.innerHTML = xmlhttp_menu.responseText;
        
        document.getElementById('sidebar').replaceChild(menu, document.getElementById('menu'));
    }
}

function getHTTPGetResponse_content () {
    if ((xmlhttp_content.readyState == 4) && (xmlhttp_content.status == 200)) {
        var content = document.createElement('div');
        content.id = 'content';
        content.innerHTML = xmlhttp_content.responseText;

        document.getElementsByTagName('body')[0].replaceChild(content, document.getElementById('content'));
    }
}
